package com.hkts.beltweigher.utils;

public class StringUtil {

    public static String changeString(String str,Float multiplier){
        String[] numbers = str.split(":");

        StringBuilder resultBuilder = new StringBuilder();
        for (String number : numbers) {
            String value = "";
            float num = Float.parseFloat(number);
            float result = num * multiplier / 100;
            if (Float.compare(result, 0.0f) == 0 ){
                value = "0";
            }else {
                value = String.valueOf(result);
            }
            resultBuilder.append(value).append(":");
        }

        // Remove the extra ":" at the end
        String resultString = resultBuilder.substring(0, resultBuilder.length() - 1);
        return resultString;
    }
}
